<%@ page language="java" import="java.util.*" import="com.java.user.user.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<jsp:useBean id="user" scope="session" class="com.java.user.User" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">
		<title>用户登录</title>
		<link href="../css/login.css" type="text/css" rel="stylesheet">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<script language="javascript">
function check(frm) {
	if (frm.userName.value === "") {
		alert("用户名不能为空！");
		return false;
	}
	if (frm.userPwd.value == "") {
		alert("密码不能为空！");
		return false;
	}
	if (frm.code.value == "") {
		alert("验证码不能为空！");
		return false;
	}
	return true;
}
function changeImage(){
	var img = document.getElementById("image");
	img.src="/blog/ValidationServlet?id="+Math.random();
}
</script>
	</head>

	<body bgcolor="black">
		<div style="margin:auto;height:60%;width:60%;background-color:2F2B2B;">
			<div
				style="margin:auto;height:90%;width:90%;background-color: rgb(128, 128, 0);">
				<form method="post" action="/blog/LoginCheckServlet" >
					<div style="margin-top: 100px;">
						<table border="0" align="center">
							<tr>
								<td colspan="2" align="center" height="40" id="title">
									<font color="#000000">用户登录</font>
								</td>
							</tr>
							<tr>
								<td align="right">
									<font color="#000000">用户：</font>
								</td>
								<td>
									<font color="#000000"><input type="text" name="userName"
											value="<%=user.getUserName()%>" style="width: 150px; height: 20px;"> </font>
									<font color="red"><%=user.getError("userName")%></font>
								</td>
							</tr>
							<tr>
								<td align="right">
									<font color="#000000">密码：</font>
								</td>
								<td>
									<font color="#000000"><input type="password"
											name="userPwd" value="<%=user.getUserPwd()%>" style="width: 150px; height: 20px;">
									</font>
									<font color="red"><%=user.getError("userPwd")%></font>
								</td>
							</tr>
							<tr>
								<td align="right">
									<font color="#000000">验证：</font>
								</td>
								<td>
									<font color="#000000"><input type="text" name="code"
											value="" style="width:150px; height: 20px;"> 
											<img alt="如果图片不清楚，请点击图片刷新" id="image" src="/blog/ValidationServlet" onClick="changeImage()">									
									</font>
									<font color="red"><%=user.getError("code")%></font>									
								</td>
							</tr>
							<tr>
								<td colspan="2" align="center" height="40">
									<font color="#000000"><a href="/blog/login/findPwd.jsp">找回密码</a>
									
									</font>
								</td>
							</tr>
							<tr>
								<td colspan="2" align="center" height="40">
									<font color="#000000"><input type="submit" value="登录">&nbsp;<input
											type="button" value="注册"
											onclick="window.location.href='/blog/login/register.jsp'">
									</font>
								</td>
							</tr>

						</table>
					</div>
				</form>

			</div>
	</div>

	</body>
</html>
